<?php
namespace app\index\controller;

use think\Db;
use app\admin\model\Lunbo;

class IndexController extends CommonController
{
    //1.前台首页
    public function index()
    {
        //1.取出轮播图
        $lunbo = (new Lunbo())->order('sort_order desc')->select();
        $this->assign('lunbo', $lunbo);
        //2.区块管理
        $block = Db::name('block')->field('content')->where('type', 'index')->find();
        // --反序列化 数据
        $data = unserialize($block['content']);
        $this->assign('data', $data);

        return $this->fetch();
    }

    //入园咨询
    public function ruzx()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'ruzx')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }
    //品牌历史
    public function ppls()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'ppls')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }

    //特色活动
    public function hdxq()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'hdxq')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }

    //点击报名
    public function specialty()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'specialty')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }
    
    //加入我们
    public function careers()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'careers')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }
    //联系我们
    public function contact()
    {
        //获取区块内容
        $content = Db::name('block')->field('content')->where('type', 'contact')->find();
        //反序列化 数据
        $data = unserialize($content['content']);

        $this->assign('data', $data);
        return $this->fetch();
    }

    //填写入园等级表
    public function form()
    {
        return $this->fetch();
    }

}
